#!/bin/sh -e

. CI/travis/lib.sh
. CI/travis/before_install_lib.sh

brew unlink python@2

brew_install_if_not_exists cmake fftw libmatio \
	libxml2 pkg-config libusb gtk+ gtkdatabox \
	jansson glib curl openssl@1.1 \
	gettext libserialport

for pkg in gettext ; do
	brew link --overwrite --force $pkg
done

if [ "$TRAVIS" == "true" ] ; then
	for pkg in libiio libad9361-iio ; do
		wget http://swdownloads.analog.com/cse/travis_builds/master_latest_${pkg}${LDIST}.pkg
		sudo installer -pkg master_latest_${pkg}${LDIST}.pkg -target /
	done
else
	cmake_build_git "libiio" "https://github.com/analogdevicesinc/libiio" "" "-DINSTALL_UDEV_RULE:BOOL=OFF"

	cmake_build_git "libad9361-iio" "https://github.com/analogdevicesinc/libad9361-iio" "" "-DLIBIIO_INCLUDEDIR:PATH=$STAGINGDIR/include -DLIBIIO_LIBRARIES:FILEPATH=$STAGINGDIR/lib/libiio.dylib"
fi

